#pragma once

// Base class for async files
// Can implement FileReadTask/FileWriteTask/FileCopyTask

class CFileIOTask
{
public:
	virtual ~CFileIOTask();
	virtual void Start() = 0;
	virtual void Cancel() = 0;

	void SetId(UINT nId) { m_nId = nId; }
	UINT GetId() const { return m_nId; }
	void SetLockExit(LockExit lockExit) { m_lockExit = std::move(lockExit); }

private:
	UINT m_nId = 0;

protected:
	LockExit m_lockExit;	// Prevent FileIOManager thread from exiting
	std::shared_ptr<CFileIOTask> m_pLockThis;	// Prevent myself from being deleted during async IO
};
